<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>统计</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/main/animate.min.css" th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
    <link href="../static/css/main/style.min862f.css" th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
    <th:block th:include="include :: header('用户管理列表')" />
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="stat-percent font-bold text-success"> <i class="fa fa-phone"></i></div>
                        <h3>昨日新增登记<span id="new_reg"></span>条</h3>
                    </div>
                    <div class="ibox-content">
                        <div class="echarts" id="echarts-bar-chart-register"></div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="stat-percent font-bold text-success"><h3>当前机构数量<span id="all_district"></span>个</h3> </div>
                        <h3>昨日新增机构<span id="new_district"></span>个</h3>
                    </div>
                    <div class="ibox-content">
                        <div class="echarts" id="echarts-bar-chart-district"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="stat-percent font-bold text-success"> <h3>当前用户数量<span id="all_admin"></span>个</h3></div>
                        <h3>昨日新增用户<span id="new_admin"></span>个</h3>
                    </div>
                    <div class="ibox-content">
                        <div class="echarts" id="echarts-bar-chart-admin"></div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="stat-percent font-bold text-success"> <h3>当前认证数量<span id="all_user"></span>个</h3></div>
                        <h3>昨日新增认证<span id="new_user"></span>个</h3>
                    </div>
                    <div class="ibox-content">
                        <div class="echarts" id="echarts-bar-chart-user"></div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row">
        </div>
      </div>
    </div>
    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/ajax/libs/flot/jquery.flot.js}"></script>

    <th:block th:include="include :: echarts-js" />
    <th:block th:include="include :: sparkline-js" />
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('dxb:userInfo:edit')}]];
        var removeFlag = [[${@permission.hasPermi('dxb:userInfo:remove')}]];
        var prefix = ctx + "djb/registry";

        let callData=[];
        let answerData=[];
        let collectData=[];
        let callTimeData=[];
        let Xais=[];

	    $(document).ready(function () {
            initAnalysis();
	    });
        function initAnalysis() {
            var barChart_register = echarts.init(document.getElementById("echarts-bar-chart-register"));
            var barChart_district = echarts.init(document.getElementById("echarts-bar-chart-district"));
            var barChart_admin = echarts.init(document.getElementById("echarts-bar-chart-admin"));
            var barChart_user = echarts.init(document.getElementById("echarts-bar-chart-user"));
            let data ={};
            $.get(prefix + "/analysisPlat", function(data) {
                if (data.code === web_status.SUCCESS) {
                    $("#new_reg").html(data.data.new_reg);
                    $("#new_district").html(data.data.new_district);
                    $("#new_admin").html(data.data.new_admin);
                    $("#new_user").html(data.data.new_user);

                    $("#all_district").html(data.data.all_district);
                    $("#all_admin").html(data.data.all_admin);
                    $("#all_user").html(data.data.all_user);

                    Xais=data.data.Xais;
                    callData=data.data.callData;
                    answerData=data.data.answerData;
                    collectData=data.data.collectData;
                    callTimeData=data.data.callTimeData;

                    baroption = {
                        // title: { text: '新增登记'},
                        tooltip: {trigger: 'axis' },
                        legend: {data: ['新增登记']},
                        grid: {x: 30,x2: 40,y2: 24},
                        calculable: true,
                        xAxis: [{type: 'category',data: Xais}],
                        yAxis: [{type: 'value'}],
                        series: [{name: '新增登记',type: 'line', data: callData,markLine: {}}]
                    }
                    barChart_register.setOption(baroption);

                    baroption2 = {
                        // title: { text: '新增机构'},
                        tooltip: {trigger: 'axis' },
                        legend: {data: ['新增机构']},
                        grid: {x: 30,x2: 40,y2: 24},
                        calculable: true,
                        xAxis: [{type: 'category',data: Xais}],
                        yAxis: [{type: 'value'}],
                        series: [{name: '新增机构',type: 'line', data: answerData,markLine: {}}]
                    }
                    barChart_district.setOption(baroption2);

                    baroption3 = {
                        // title: { text: '新增用户'},
                        tooltip: {trigger: 'axis' },
                        legend: {data: ['新增用户']},
                        grid: {x: 30,x2: 40,y2: 24},
                        calculable: true,
                        xAxis: [{type: 'category',data: Xais}],
                        yAxis: [{type: 'value'}],
                        series: [{name: '新增用户',type: 'line', data: collectData,markLine: {}}]
                    }
                    barChart_admin.setOption(baroption3);

                    baroption4 = {
                        // title: { text: '新增认证'},
                        tooltip: {trigger: 'axis' },
                        legend: {data: ['新增认证']},
                        grid: {x: 30,x2: 40,y2: 24},
                        calculable: true,
                        xAxis: [{type: 'category',data: Xais}],
                        yAxis: [{type: 'value'}],
                        series: [{name: '新增认证',type: 'line', data: callTimeData,markLine: {}}]
                    }
                    barChart_user.setOption(baroption4);

                    // window.onresize = barChart_district.resize;
                } else {
                    $.modal.alertError(data.msg);
                }
            });

            // $.ajax({
            //     type: "get",
            //     url: prefix + "/analysisPlat",
            //     // data: JSON.stringify(data),
            //     cache: false,
            //     contentType: "application/json",
            //     processData: false,  //必须false才会避开jQuery对 formdata 的默认处理
            //     dataType: 'JSON',
            //     async:false,
            //     success: function(data) {
            //         if (data.code === web_status.SUCCESS) {
            //             // $("#call_num").html(data.data.call_num);
            //             // $("#answer_num").html(data.data.answer_num);
            //             // $("#collect_num").html(data.data.collect_num);
            //             // $("#call_time").html(data.data.call_time);
            //             // $("#answer_rat").html(data.data.answer_rat);
            //             // $("#collect_rat").html(data.data.collect_rat);
            //             // $("#call_avg").html(data.data.call_avg);
            //
            //             Xais=data.data.Xais;
            //             callData=data.data.callData;
            //             // answerData=data.data.answerData;
            //             // collectData=data.data.collectData;
            //             // callTimeData=data.data.callTimeData;
            //             // Datas=data.data.tableData;
            //         } else {
            //             $.modal.alertError(data.msg);
            //         }
            //     },
            //     error: function(error) {
            //         $.modal.alertWarning("服务器出错，请联系客服");
            //     }
            // });

            // $(".dimension").html(dimension);
        }

    </script>
</body>
</html>
